package com.flying.other;

import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Arrays;
import java.util.Locale;
import java.util.Scanner;

/**
 * @author 刘鹏飞
 * @ClassName SystemDemo
 * @Date 2024/12/21 21:48
 * @Created by 刘鹏飞
 * @Description System的使用
 */
public class SystemDemo {
    public static void main(String[] args) throws FileNotFoundException {

        // in. 标准输入
        //  监听系统的输入

        Scanner scanner=new Scanner(System.in);

        // out 标准输出
        //  更改输出位置
//        PrintStream printStream = new PrintStream("log.txt");
//        System.setOut(printStream);
//        System.out.println("hello");
//
//        System.setErr(new PrintStream("error.txt"));
//
//        int[] x={12,3};
//        System.err.println(x[6]);

        System.out.println(System.getenv());  // 获取系统环境

        System.out.println(System.getProperties());  // 属性

        System.out.println("==============================================");
        System.out.println(System.getProperty("java.runtime.name"));  // Java(TM) SE Runtime Environment


        System.out.println(System.currentTimeMillis());

        Instant instant = Instant.ofEpochMilli(System.currentTimeMillis());
        System.out.println(instant);


        // System.arraycopy(): 复制数组

        String[] names={"Jack","tony","lisi","lili","wubi",null,null,null};
        System.arraycopy(names, 0, names, 5, 3);

        System.out.println(Arrays.toString(names));


    }

}
